package com.dkm.biz.gl.persistence.dao.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.dkm.base.api.annotion.SKGCacheEvict;
import com.dkm.base.api.constants.RedisConstants;
import com.dkm.base.db.mybatis.dao.MyBatisDaoImpl;
import com.dkm.biz.gl.persistence.dao.GlCateDao;
import com.dkm.biz.gl.persistence.entity.GlCatePo;

/**
 * 对象功能:总分类表。用于显示树层次结构的分类，可以允许任何层次结构。 Dao接口的实现类
 * 开发公司:唯心六艺软件 - Craft6.cn
 * 开发人员:winston
 * 创建时间:2014-07-22 11:07:05
 */
@Repository
public class GlCateDaoImpl extends MyBatisDaoImpl<String, GlCatePo> implements GlCateDao{

	private final static String name = "com.skg.biz.gl.persistence.entity.GlCatePo";
	
    @Override
    public String getNamespace() {
        return GlCatePo.class.getName();
    }

    /***
	 * 根据key删除缓存
	 */
	public void subDelete(String id) {
		super.delete(id);
	}
	
	/***
	 * 清除redis某个缓存数据库
	 */
	public void clearRedisCache() {
		// TODO Auto-generated method stub
		
	}
	/***
	 * 模糊匹配删除缓存
	 */
	public void deleteCacheByPrefix() {
		// TODO Auto-generated method stub
		
	}

	/**
	 * 根据父id删除类型 
	 */
	@Override
	public void deleteChildrenByGlCate(String glCateId,String typeKey) {
		    Map<String, Object> params = new HashMap<>();
		    params.put("parentId", "%"+glCateId+"%");
		    params.put("typeKey", typeKey);
			this.deleteByKey("deleteParentGlCate", params);
	}

	@Override
	public void deleteChildrenByParent(String parentId, String tag) {
		 Map<String, Object> params = new HashMap<>();
		 params.put("parentId", parentId);
		 params.put("tag", tag);
		this.updateByKey("deleteChildrenByParent", params);
	}
}
